10 turtle(int W
, int S
) : w(W
), s(S
) {}
11 bool operator < (const turtle
&y
) const{
12 return (s
- w
< y
.s
- y
.w
) ||
13 (s
- w
== y
.s
- y
.w
&& w
< y
.w
) ||
14 (s
- w
== y
.s
- y
.w
&& w
== y
.w
&& y
.s
< y
.w
);
16 bool operator == (const turtle
&y
) const{return w
== y
.w
&& s
== y
.s
;}
18 bool operator > (const turtle
&x
, const turtle
&y
){return !(x
== y
) && !(x
< y
);}
23 while (cin
>> x
>> y
){
25 t
.push_back(turtle(x
,y
));
27 sort(t
.begin(), t
.end(), greater
<turtle
>() );
29 /*for (int i=0; i<t.size(); ++i){
30 cout << "turtle[i]: " << t[i].w << " " << t[i].s;
34 vector
<int> p(t
.size()), dp(t
.size());
35 for (int i
=0; i
<t
.size(); ++i
){
37 p
[i
] = t
[i
].s
- t
[i
].w
;
38 for (int j
=0; j
<i
; ++j
){
40 if (dp
[i
] < dp
[j
] + 1){
42 p
[i
] = min(p
[j
] - t
[i
].w
, t
[i
].s
- t
[i
].w
);
47 cout
<< *(max_element(dp
.begin(), dp
.end())) << endl
;